The present invention relates to a method for calibrating a photoelectric cell.
Photoelectric cells are commonly used in a wide range of fields, and with different functions, all of which nevertheless can be said to relate to a switching between two states of a user, caused by the change of the luminous signal received by a photo-receiver of the photoelectric cell when an object (or a person) passes in the field of optical detection of the photoelectric cell, superimposing itself to the detection background and intercepting the light beam emitted by a photo-emitter of the photoelectric cell.
In fact, generally a photoelectric cell comprises a photo-emitter, which generates a luminous signal, a photo-receiver or photodetector, which receivesxe2x80x94directly or after reflectionxe2x80x94the luminous signal emitted by the photoemitter and converts it into an electrical signal, and a comparator, which compares the signal received to a triggering threshold and provides a binary output signal that represents the presence or the absence of an object, and which is used for driving a user.
For sake of brevity, the terms xe2x80x9cTargetxe2x80x9d and xe2x80x9cBackgroundxe2x80x9d in the following description shall be indifferently used to indicate respectively both the object and the signal detected in the presence of the object, and both the detection background and the signal detected in the absence of the object.
In the following description, and according to the current terminology, the photoelectric cell is said to operate xe2x80x9cin the lightxe2x80x9d if the output is active when the sensor is in the operating condition in which it receives the maximum light, that is to say, above the triggering threshold. Vice versa, the photoelectric cell is said to operate xe2x80x9cin the darkxe2x80x9d if the output is active when the sensor is in the operating condition in which it receives the minimum light, that is to say, below the triggering threshold.
Since photoelectric cells are commonly provided with a normal output or Q, and a complementary output or Qneg, the operation xe2x80x9cin the lightxe2x80x9d or xe2x80x9cin the darkxe2x80x9d can be selected using the output that meets the requirements of the particular user. Among the typical applications, in proximity applications, based on the reflection of the light by the object intercepting the light beam emitted by the photo-emitter, the most typical operation is that in the light, corresponding to the activation of the photoelectric cell in the presence of the object. On the other hand, in xe2x80x9cbarrierxe2x80x9d applications, that is, based on the object interrupting the light beam emitted by the photo-emitter, the most typical logic of operation is that in the dark, again corresponding to the activation of the photoelectric cell in the presence of the object. Usually, barrier applications are further distinguished between xe2x80x9cthrough-beam barrier applicationsxe2x80x9d, wherein the photodetector and the photo-emitter are housed in separate devices which are mounted so as to face each other, and xe2x80x9cretroreflex barrier applicationsxe2x80x9d, wherein the light emitted by the photo-emitter is reflected by a prismatic reflector, which sends it to the photo-receiver, housed in the same device as the photo-emitter.
In any case, the photoelectric cells must be calibrated upon installation, that is to say, the triggering threshold must be set according to the type of object to be detected and according to the distance of the object itself.
A first calibration method is the so-called variable-resistance or trimmer acquisition method: during calibration, for example in the xe2x80x9cproximityxe2x80x9d case, the object is arranged into the detection field, and the trimmer is brought to the minimum position, after which it is rotated, thus increasing the sensitivity of the photo-receiver, until the in-the-light output turns on. At that point, the rotation is continued for a little more so as to have a triggering threshold corresponding to a greater distance of the target.
However, in photoelectric cells with key calibration, the calibration occurs through two different acquisition steps: Target acquisition and Background acquisition.
FIG. 1 illustrates a flow chart of the known dual-acquisition calibration method, which provides for a sequence of at least two pressures of the calibration key (alternatively, there can be two different keys, one for the Target and another for the Background, the logic of operation being totally equivalent). Thus, starting from an operating state 100 of the photoelectric cell, in a first block 102 a first pressure of the acquisition key is waited for, which must last for some seconds, as checked in a block 104; otherwise, the operating state 100 is returned to, cancelling the acquisition in block 106. Usually, furthermore, as indicated with reference numeral 108, there is a visual indication of the pressure of the acquisition key. If the first key pressure lasts enough, the Target acquisition block 110 is entered, accompanied by the visual indication of acquisition in progress and successful acquisition. As indicated with reference numeral 112, at this point it is waited for the key to be released for at least one moment, and afterwards, a second pressure of the key is waited for (block 114), also lasting for a certain period of time (block 116) and accompanied by a visual indication (block 118). Should that be the case, the Background acquisition is carried out in block 120, accompanied by the visual indication. Then, in a block 122, it is checked whether the contrast between Target and Background is sufficient, as it shall be better described hereinafter, visually indicating the occurrence or the failure of the calibration in blocks 124 and 126, respectively. In positive case, the photoelectric cell returns to the operating state 100, whereas in negative case, block 102 is returned to, waiting for the first key pressure.
With reference to FIG. 2, which graphically illustrates the signal levels concerning the traditional calibration of a photoelectric cell, it must be specified that when both the Target and the Background are acquired, actually a certain number of readings is carried out so as to obtain a first series of data associated to the Target, and a second series of data associated to the Background. The maximum TM and the minimum Tm reading signal for the Target and the maximum SM and the minimum Sm reading signal for the Background are extracted from this series of data. Then, the traditional calibration algorithm provides for calculating the interval amplitudes between the maximum and minimum value detected, xcex4T=TMxe2x88x92Tm and xcex4S=SMxe2x88x92Sm, multiplying the greatest one (to which a suitable constant can be added in advance) by a safety constant, and finally, checking whether the distance xcex4 between the intervals is greater than the product thus obtained. This is the acquisition validity condition. More in particular, the distance xcex4 is calculated as xcex4=Tmxe2x88x92SM in the case (FIG. 2) of Target more luminous than the Background, as it happens in proximity applications, whereas it is calculated as xcex4=Smxe2x88x92TM in the case (not shown) of Target less luminous than the Background, as it happens in barrier applications.
If the validity condition is met, the triggering threshold F is typically set exactly in the middle of the distance xcex4, that is to say, in the case shown in FIG. 2, to F=SM+xcex4/2=Tmxe2x88x92xcex4/2. In the case (not shown) of Target less luminous than the Background, the triggering threshold is typically set to F=TM+xcex4/2=Smxe2x88x92xcex4/2.
Afterwards, the triggering hysteresis is calculated, that is to say, the actual switching-on threshold Fon and switching-off threshold Foff of the photoelectric cell are respectively set by adding to and subtracting from (or vice versa, for the operation in the dark, not shown) the triggering threshold F an hysteresis amount, which can be fixed or proportional to the triggering threshold F.
It must be emphasized that all constants used in the calibration algorithm, including the safety constant and the hysteresis amount, can be different according to the type of photoelectric cell, as they depend on the optical and electronic performances of the specific photoelectric cell. Photoelectric cells with a good optics and good electronics, that is, xe2x80x9cstablexe2x80x9d, can afford using a little constant, whereas not very xe2x80x9cprecisexe2x80x9d photoelectric cell need a greater constant.
Dual-acquisition calibration, according to the prior art, allows optimising the triggering threshold of the photoelectric cell and automatically selecting the operation in the light for the main output Q when the Target is more luminous than the Background or vice versa, the operation in the dark for the main output Q when the Target is less luminous than the Background.
However, the traditional calibration is quite slow and complex, which can be unsatisfactory especially if the accuracy of the detection is not particularly critical.
Thus, the technical problem at the basis of the present invention is to provide an easier and faster calibration method.
This problem is solved, according to the invention, in a method for calibrating a photoelectric cell comprising the steps of carrying out a first acquisition through a certain number of detections of the photoelectric cell in a first condition of the detection field, defining a first interval between the minimum value and the maximum value detected in the first acquisition step, setting a triggering threshold as a value spaced from said first interval by a triggering amount, characterised in that said triggering amount is a function of the amplitude of said first interval.
By xe2x80x9ccondition of the detection fieldxe2x80x9d it is meant in the presence or absence of an object, respectively. Said method allows avoiding the second acquisition needed in the prior art, that is to say, the step of carrying out a certain number of detections of the photoelectric cell in the opposed condition of the detection field, thus saving time during the calibration.
More in particular, when the first acquisition step occurs carrying out the detections in the condition of the greatest luminosity of the detection field, between the absence and the presence of the object, in the setting step the triggering threshold is set as a value spaced below the first interval by the triggering amount.
Vice versa, when the first acquisition step occurs carrying out the detections in the condition of the lowest luminosity of the detection field, between the absence and the presence of the object, in the setting step the triggering threshold is set as a value spaced above the first interval by the triggering amount.
Preferably, the triggering amount is proportional to the amplitude of the first interval through a safety constant. Such a function exhibits the advantage of being extremely simple, while providing for a certain margin of safety in the setting of the threshold.
More in particular, the safety constant is an inverse function of the optical and electronic performances of the photoelectric cell. In this way, the margin of safety is set in a specific way with respect to the stability of the single photoelectric cell, optimising the distance of the triggering threshold from the expectable range of readings during the operation of the photoelectric cell.
Advantageously, moreover, the safety constant is selectable from a certain number of preset values. This offers the advantage of allowing the final user to optimise the distance of the triggering threshold according to the accuracy requirements of the specific application, still without imposing excessively hard calculations on him.
Advantageously, moreover, the step of setting the triggering threshold is subordinated to a step of checking that said minimum detected value is greater than a preset minimum value. In this way, the calibration is prevented in case the detection field of the photoelectric cell being used is not very luminous, a condition that could imply setting an unreliable triggering threshold.
Moreover, in the method of the invention, preferably the first acquisition step is subordinated to a step of detecting the pressure of an acquisition key for a time at least equal to a preset minimum time. This allows preventing an undesired calibration of the photoelectric cell due to an accidental pressure of the key.
In a second embodiment, the method of the present invention is characterised by the further steps of receiving a selection signal through input means of the photoelectric cell, and if said selection signal has a predetermined value, carrying out a second acquisition through a certain number of second detections of the photoelectric cell in a second condition of the detection field. In this way, the user is provided with the possibility of choosing, upon calibration, the traditional dual-acquisition calibration method, which in some cases can be preferable.
Preferably, said selection signal has said predetermined value if it is detected that the pressure of an acquisition key is being maintained until the end of the first acquisition step.
The method is preferably characterised in that it further comprises the step of defining a second interval between the minimum value and the maximum value detected in the second acquisition, and in that in the step of setting the threshold, said triggering amount is a function of the distance between said first interval and said second interval.
In a preferred way, the triggering amount is proportional to said distance. In an even more preferred way, the triggering amount is equal to half said distance.
In this embodiment, moreover, said step of setting the triggering threshold can be subordinated to a step of checking that said distance is greater than the maximum amplitude between the amplitude of said first interval and the amplitude of said second interval, preferably multiplied by a constant. This allows preventing the calibration in case the reading ranges of the photoelectric cell, in the absence and presence of the object to be detected, are not sufficiently distinct, thus implying a high probability of wrong detection.
Advantageously, the second acquisition step is subordinated to the detection of the pressure of an acquisition key of the photoelectric cell for a time at least equal to a preset minimum time.
In both embodiments, moreover, it can be advantageous to provide for the further steps of setting an activation threshold and a deactivation threshold respectively spaced from said triggering threshold (F) by a hysteresis amount. In this way, in fact, a further margin of safety in the detection is set because, during the rise of the signal, the photoelectric cell switches after having exceeded the triggering threshold and in the same way, during the fall of the signal, the photoelectric cell switches when the signal has further reduced with respect to the triggering threshold.
Typically, moreover, the hysteresis amount is proportional to the triggering threshold. Otherwise, there would be the risk of setting the activation and deactivation thresholds too much beyond the triggering threshold, thus worsening the reliability of the detection instead of improving it.